﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Stamp_For_Africa_Version_2.Repositories;
using Stamp_For_Africa_Version_2.ViewModels;

namespace Stamp_For_Africa_Version_2.Controllers
{
    public class NewsController : Controller
    {
        //
        // GET: /News/

        public ActionResult Index()
        {
          NewsViewModel newsViewModel = new NewsViewModel();
          StampRepository stampRepository = new StampRepository();
          newsViewModel.LatestStamps =
            stampRepository.FindAllStamps(Guid.Empty).Where(u => u.DateAdded > DateTime.Now.AddDays(-1)).ToList();
          return View(newsViewModel);
        }

      public ActionResult ViewStamp(Guid id)
      {
        return RedirectToAction("Details", "Stamps", new {id});
      }

    }
}
